from package.sqlite_mgr import Database_Integration_Operations as DIO

dio  = DIO(r'D:/more/Django_Project/GoodSystem/sale/db.sqlite3')
# 建立表对象
table_goods = dio.getTable('goods')
ColumnName = 'name'
ColumnUnit = 'unit'
ColumnPrice = 'price'

# 添加商品信息
def add_goods(newName, newUnit, newPrice):
    table_goods.appendItem((ColumnName, ColumnUnit, ColumnPrice),(newName, newUnit, newPrice))
    dio.save()


# 修改商品信息
def alter_goods(IdValue, newName, newUnit, newPrice):
    table_goods.updateItem(IdValue, (ColumnName, ColumnUnit, ColumnPrice),(newName, newUnit, newPrice))
    dio.save()

# 删除商品信息
def delete_goods(IdValue):
    table_goods.deleteItem(IdValue)
    dio.save()


# 显示商品信息
def display_goods():
    return table_goods.selectTableAllItems()

